package week12.topic11;

import org.eclipse.paho.client.mqttv3.MqttException;

import java.util.Scanner;

public class User2 {
    public static void main(String[] args) throws MqttException {
        String host = "tcp://127.0.0.1:1883";
        String userName = "admin";
        String passWord = "admin";
        String topicName = "chat_room";
        ChatRoom root = new ChatRoom(host, userName, passWord, topicName);
        root.publish("abc");
        Scanner input = new Scanner(System.in);
        while (true) {
            System.out.println("请输入一个字符串(中间能加空格或符号)");
            String text = input.nextLine();
            root.publish(text);
        }

    }
}
